import React, { Component } from 'react'

export default class Str extends Component {
    constructor () {
        super();
        this.state = {
            str: '大白',
            html: "<button>走</button>"
        }
    }
    changeStr(str) {
        this.setState({
            str
        })
    }
    render() {
        return (
            <div>
                <h1>{this.state.str}</h1>
                <span>输入</span>
                <input value={this.state.str} onChange={(e) => this.changeStr(e.target.value)} />
                <div>{this.state.html}</div>
                <div dangerouslySetInnerHTML={{ __html: this.state.html }}></div>
            </div>
        )
    }
}
